<?php

/**
 * Models a value/label pair
 * 
 *
 * @see ListItemCollection
 * @author Ben Rowe
 */
class ListItem
{
	/**
	 * Stores the value
	 *
	 * @access private
	 * @var mixed
	 */
	var $_value;
	
	/**
	 * Stores the label
	 *
	 * @access private
	 * @var string
	 */
	var $_label;
	
	/**
	 * Constructor
	 * Set's both the value & label
	 *
	 * @access public
	 * @param mixed $value
	 * @param string $label
	 * @return ListItem
	 */
	function ListItem($value = false, $label = null)
	{
		$this->_value = $value;
		$this->_label = $label;
	}
	
	/**
	 * Retrieve the value
	 *
	 * @access public
	 * @return mixed
	 */
	function getValue()
	{
		return $this->_value;
	}
	
	/**
	 * Retrieve the label
	 * If the label is not provided it'll return a serialised
	 * version of the value
	 *
	 * @access public
	 * @return string
	 */
	function getLabel()
	{
		if($this->_label !== null) {
			return $this->_label;
		}
		return $this->_value;
	}
}

?>